Partial Class AppMaster
    Inherits MasterPage

    Dim oLogin As New Datos.Login
    Protected Sub Themepicker_Command(ByVal sender As Object, ByVal e As CommandEventArgs)

        ' Set the StylesheetTheme in the user's profile to the selected value and 
        ' reload the page so the change can be applied.
        Profile.StylesheetTheme = e.CommandName
        Response.Redirect(Request.FilePath, False)
    End Sub

    Protected Sub ButtonLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonLogin.Click
        Dim resuLogin As Integer
        resuLogin = oLogin.LoginOK(Me.TextBoxUser.Text, Me.TextBoxPass.Text)
        If resuLogin = 1 Then

            If Me.TextBoxUser.Text = "admin" Then
                Session.Add("cuit", Me.TextBoxUser.Text)
                Response.Redirect("InicioAdmin.aspx")
            Else
                Session.Add("cuit", Me.TextBoxUser.Text)
                Response.Redirect("InicioCliente.aspx")
            End If
            
        Else
            If resuLogin = 2 Then
                Me.Label1.Text = "Usuario no Confirmado Comuniquese con el Administrador"
            Else
                Me.Label1.Text = "Usuario no Registrado."
            End If
        End If
    End Sub

End Class
